home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17317 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.8 KB  |  67 lines

  1. Newsgroups: comp.lang.c++
  2. Path: netcom.com!marnold
  3. From: marnold@netcom.com (Matt Arnold)
  4. Subject: Re: The STL and nested structures
  5. Message-ID: <marnoldDpvnI6.FwC@netcom.com>
  6. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  7. References: <4ju9q7$fa1$1@mhadg.production.compuserve.com> <316a26d7.2989288@news.cyberport.com> <marnoldDpn0HH.3z2@netcom.com> <3170bdd7.308224233@news.cyberport.com>
  8. Date: Mon, 15 Apr 1996 00:18:05 GMT
  9. Sender: marnold@netcom18.netcom.com
  10.  
  11. tangent@cyberport.com (Warren Young) writes:
  12.  
  13. >marnold@netcom.com (Matt Arnold) wrote:
  14.  
  15. >>>>I am having a problem using the STL with structures defined within 
  16. >>>>a class definition.  Consider the following code fragment.
  17. >>>>...
  18. >>>>The compiler I am using (VC 4.1) refuses to compile.  An error is 
  19. >>>>generated the says "'Foo' : undeclared identifier" at line 75 in 
  20. >>>>vector.h.
  21. >>
  22. >>>It _is_ undeclared, just as a variable local to a function foo() is
  23. >>>undeclared in a function bar().  What you want to say is:
  24. >>
  25. >>This should not be necessary.  Nested class Foo should be visible for
  26. >>use in template member Bar::fooContainer.  fooContainer is in Bar's
  27. >>scope.  There should be no problem referring to it within Bar.  
  28.  
  29. >Yep, you're right.  I didn't look at the code carefully enough.
  30.  
  31. >>I think Visual C++ is broken on the above code.  It compiles fine in 
  32. >>Borland C++.
  33.  
  34. >Once again, I'm pulled back from the MS abyss...
  35.  
  36. >>>Even this won't work until Foo is placed in the public section of the
  37. >>>class (as shown above, it's in the private (default) section).
  38. >>
  39. >>That requirement would make private nested implementation class'
  40. >>impossible, wouldn't it?
  41.  
  42. >Assuming he was declaring the vector outside the class's scope, I was
  43. >right.  Once you get the straight dope on that, and the rest of the
  44. >post is rubbish.  It all depended on that one premise.
  45.  
  46. >>Is it true that STL is currently incorrectly implemented?
  47.  
  48. >By who, and in what regard?  I hadn't heard anything of this.  Unless
  49.  
  50. I meant, because STL uses private nested classes employed as template 
  51. parameters for other elements of the nesting classes, your original
  52. premise implied that STL must rely on incorrect compiler behavior.  I
  53. made this comment simply as an example to back up my assertion that 
  54. your premise was in error.  That's all, I didn't mean to imply that
  55. STL was actually incorrectly implemented.
  56.  
  57. Regards,
  58. -------------------------------------------------------------------------
  59. Matt Arnold                       |        | ||| | |||| |  | | || ||
  60. marnold@netcom.com                |        | ||| | |||| |  | | || ||
  61. Boston, MA                        |      0 | ||| | |||| |  | | || ||
  62. 617.389.7384 (h) 617.576.2760 (w) |        | ||| | |||| |  | | || ||
  63. C++, MIDI, Win32/95 developer     |        | ||| 4 3 1   0 8 3 || ||
  64. -------------------------------------------------------------------------
  65.  
  66.  
  67.